﻿@model IEnumerable<e_commerce.Foreground.Models.DeliveryInfo>
@using e_commerce.Models;
@{
    var client = Session["Client"] as ClientModel;
}

@{
    ViewBag.Title = "地址管理";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<section class="deliver-wrap">
    <input type="hidden" value="@Model.Count()" id="deliver_count" />
    <h1>新增地址(您目前有<span class="deliver-count">@Model.Count()</span>条地址，最多可以增加<span class="deliver-left-count"></span>条地址)</h1>
    <div class="add-new-di">
        <form method="post">
            <div class="short-message">
                <div class="deliver-name">
                    <span>收货人姓名: </span>
                    <input type="text" id="Name" />
                </div>
                <div class="deliver-phone">
                    <span>收货人手机号: </span>
                    <input type="text" id="PhoneNumber" />
                </div>
            </div>
            <div class="long-message">
                <span>收货人地址: </span><input type="text" id="Deliver" />
            </div>
            <a href="javascripts:void(0);" id="submit_bt">
                <span>
                    保存
                </span>
            </a>
        </form>
    </div>
    <div class="exite-info">
        <h1>已有地址</h1>
        <div class="deliver-table-head">
            <span>收货人姓名</span>
            <span>收货人地址</span>
            <span>收货人手机号</span>
            <span>操作</span>
        </div>

        @foreach (var item in Model)
        {
            if (item.IsDefault)
            {
                <div class="deliver-info blue">
                    <span>@item.Name </span>
                    <span>@item.Address</span>
                    <span>@item.PhoneNumber</span>
                    <span>
                        <input type="hidden" value="@item.Id" />
                        <a class="modify" href="javascripts:void(0);">修改</a>
                        <a class="default" href="javascripts:;">设为默认</a>
                        <a class="delete" href="javascripts:void(0);">删除</a>
                    </span>
                </div>
            }
            else
            {
                <div class="deliver-info">
                    <span>@item.Name </span>
                    <span>@item.Address</span>
                    <span>@item.PhoneNumber</span>
                    <span>
                        <input type="hidden" value="@item.Id" />
                        <a class="modify" href="javascripts:void(0);">修改</a>
                        <a class="default" href="javascripts:;">设为默认</a>
                        <a class="delete" href="javascripts:void(0);">删除</a>
                    </span>
                </div>
            }
        }
    </div>
</section>

@section Styles{
    <link href="~/CSS/deliver.css" rel="stylesheet" />
}
@section Scripts{
    <script src="~/JS/CheckDeliveryInfo.js"></script>
}